package com.colliery.model;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;

public class imgTest {
    public static void main(String[] args) throws IOException {
        FileInputStream inputStream = null;
        try {
            Base64.Encoder encoder = Base64.getEncoder();

            inputStream = new FileInputStream("http://192.168.6.188:9999/customer/tcjtZcCustomer/static/customer/personal/8d0ecf7c2ff242a12b0522c274d13dd_1652064318192.jpg");

            int available = inputStream.available();
            byte[] bytes = new byte[available];
            inputStream.read(bytes);

            String base64Str = encoder.encodeToString(bytes);
            System.out.println(base64Str);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            inputStream.close();
        }
    }
    }


